from django.shortcuts import render,HttpResponse,redirect

# Create your views here.
def index_view(request):
    user_dict = {'username': 'jason', 'pwd': 123}
    user_list = [111,333,444,555,666,777,666]
    return render(request, 'index.html',locals())
    # return HttpResponse("hello django")
    # return redirect('/home/')
def home_view(request):
    return HttpResponse('HOME CKK')

def login_view(request):
    # return render(request, 'login.html')
    if request.method == 'POST':
        # print(request.POST)  # <QueryDict: {'username': ['WWWW'], 'password': ['WWWW']}>
        # print(request.POST.get('username'))  # 获取列表最后一条数据
        # print(request.POST.getlist('username'))  # 获取整个列表数据
        print(request.GET.get('username'))  # 获取列表最后一个数据
        print(request.GET.getlist('username'))  # 获取整个列表数据
        return HttpResponse('数据ckk')
        username = request.POST.get('username')
        password = request.POST.get('password')
        if username == 'ckk' and password == '123':
            return HttpResponse('ckk nb')
        else:
            return HttpResponse('用户名或密码错误')
    elif request.method == 'GET':
        return render(request, 'login.html')